package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.KnowledgeCategoryMapper;
import com.ruoyi.system.domain.KnowledgeCategory;
import com.ruoyi.system.service.IKnowledgeCategoryService;

/**
 * 知识分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-23
 */
@Service
public class KnowledgeCategoryServiceImpl implements IKnowledgeCategoryService 
{
    @Autowired
    private KnowledgeCategoryMapper knowledgeCategoryMapper;

    /**
     * 查询知识分类
     * 
     * @param id 知识分类主键
     * @return 知识分类
     */
    @Override
    public KnowledgeCategory selectKnowledgeCategoryById(Long id)
    {
        return knowledgeCategoryMapper.selectKnowledgeCategoryById(id);
    }

    /**
     * 查询知识分类列表
     * 
     * @param knowledgeCategory 知识分类
     * @return 知识分类
     */
    @Override
    public List<KnowledgeCategory> selectKnowledgeCategoryList(KnowledgeCategory knowledgeCategory)
    {
        return knowledgeCategoryMapper.selectKnowledgeCategoryList(knowledgeCategory);
    }

    /**
     * 新增知识分类
     * 
     * @param knowledgeCategory 知识分类
     * @return 结果
     */
    @Override
    public int insertKnowledgeCategory(KnowledgeCategory knowledgeCategory)
    {
        knowledgeCategory.setCreateTime(DateUtils.getNowDate());
        return knowledgeCategoryMapper.insertKnowledgeCategory(knowledgeCategory);
    }

    /**
     * 修改知识分类
     * 
     * @param knowledgeCategory 知识分类
     * @return 结果
     */
    @Override
    public int updateKnowledgeCategory(KnowledgeCategory knowledgeCategory)
    {
        knowledgeCategory.setUpdateTime(DateUtils.getNowDate());
        return knowledgeCategoryMapper.updateKnowledgeCategory(knowledgeCategory);
    }

    /**
     * 批量删除知识分类
     * 
     * @param ids 需要删除的知识分类主键
     * @return 结果
     */
    @Override
    public int deleteKnowledgeCategoryByIds(Long[] ids)
    {
        return knowledgeCategoryMapper.deleteKnowledgeCategoryByIds(ids);
    }

    /**
     * 删除知识分类信息
     * 
     * @param id 知识分类主键
     * @return 结果
     */
    @Override
    public int deleteKnowledgeCategoryById(Long id)
    {
        return knowledgeCategoryMapper.deleteKnowledgeCategoryById(id);
    }
}
